package com.mypage.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.cloudcc.mobile.R;
import com.mypage.bean.CustomListBean;
import com.mypage.bean.QueryCustomListBean;

import java.util.List;

/**
 * Created by liuyongjie on 2017/5/11.
 */

public class NDefauleChageListAdapter extends BaseAdapter {

    public List<CustomListBean.CustomData.Custom> mList;
    public Context context;
    public NDefauleChageListAdapter(List<CustomListBean.CustomData.Custom> mList, Context context){
        this.mList = mList;
        this.context = context;
    }
    @Override
    public int getCount() {
        return mList.size()==0?0:mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if (convertView==null){
            viewHolder = new ViewHolder();
            convertView = View.inflate(context, R.layout.custom_list_item,null);
            viewHolder.customName = (TextView) convertView.findViewById(R.id.customName);
            convertView.setTag(viewHolder);
        }else{
            viewHolder = (ViewHolder) convertView.getTag();
        }
        viewHolder.customName.setText(mList.get(position).name.toString());
        return convertView;
    }

    public class ViewHolder{
        TextView customName;
    }
}
